/**
 * 
 */
package tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import reit.main.*;


/**
 * @author Mordechai
 *
 */
public class RepairObjectTest {
	private RepairTool repairTool;
	private RepairMaterial repairMaterial;

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		repairTool = new RepairTool("Hammer",0);
		repairMaterial = new RepairMaterial("Wool", 0);
		
	}

	/**
	 * Test method for {@link reit.main.RepairObject#RepairObject(java.lang.String, int)}.
	 */
	@Test
	public void testRepairObject() {
		assertEquals(0,repairTool.getQuantity(),0);
		assertEquals(0,repairMaterial.getQuantity(),0);
	}

	/**
	 * Test method for {@link reit.main.RepairObject#reduceQuantityBy(reit.main.RepairObjectInterface)}.
	 */
	@Test
	public void testReduceQuantityBy() {
		repairTool.increaseQuantityBy(new RepairTool("Hammer",5));
		repairTool.reduceQuantityBy(new RepairTool("Hammer",3));
		assertEquals(2,repairTool.getQuantity(),0);
		
		repairMaterial.increaseQuantityBy(new RepairTool("Wool",5));
		repairMaterial.reduceQuantityBy(new RepairTool("Wool",3));
		assertEquals(2,repairTool.getQuantity(),0);
	}

	/**
	 * Test method for {@link reit.main.RepairObject#increaseQuantityBy(reit.main.RepairObjectInterface)}.
	 */
	@Test
	public void testIncreaseQuantityBy() {
		repairTool.increaseQuantityBy(new RepairTool("Hammer",5));
		assertEquals(5,repairTool.getQuantity(),0);
		
		repairMaterial.increaseQuantityBy(new RepairTool("Wool",5));
		assertEquals(5,repairTool.getQuantity(),0);
	}

	/**
	 * Test method for {@link reit.main.Quantifiable#getQuantity()}.
	 */
	@Test
	public void testGetQuantity() {
		repairTool.increaseQuantityBy(new RepairTool("Hammer",7));
		assertEquals(7,repairTool.getQuantity(),0);
		repairTool.increaseQuantityBy(new RepairTool("Hammer",8));
		assertEquals(15,repairTool.getQuantity(),0);
		
		repairMaterial.increaseQuantityBy(new RepairTool("Wool",7));
		assertEquals(7,repairMaterial.getQuantity(),0);
	}

	/**
	 * Test method for {@link reit.main.Namable#getName()}.
	 */
	@Test
	public void testGetName() {
		assertEquals("Wool",repairMaterial.getName());
		assertEquals("Hammer",repairTool.getName());

	}

}
